package com.retail.lottery.colalottery.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.retail.lottery.colalottery.enums.OrderCallbackStatusEnum;
import com.retail.lottery.colalottery.service.OrderCallBackMessageService;
import com.retail.lottery.colalottery.vo.request.OrderCallBackVo;
import com.retail.lottery.colalottery.vo.response.OrderCallBackResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class OrderCallBackMessageServiceImpl implements OrderCallBackMessageService {

//    @Autowired
//    private RabbitTemplate rabbitTemplate;

    @Override
    public OrderCallBackResponse orderCallBackMessageEvent(OrderCallBackVo orderCallBackVo) {
        OrderCallBackResponse response = new OrderCallBackResponse();
        try {
            //rabbitTemplate.convertAndSend(OrderCallbackProductConfig.ORDER_CALLBACK_EXCHANGE, OrderCallbackProductConfig.ORDER_CALLBACK_ROUTING_KEY, JSONObject.toJSONString(orderCallBackVo));
            log.info("发送接收到的数据：{}", JSONObject.toJSONString(orderCallBackVo));
        } catch (Exception e) {
            log.error("orderCallback mq接口调用内部处理异常：", e);
            throw new RuntimeException(e);
        }
        response.setResult_code(OrderCallbackStatusEnum.all_ok.getCode());
        return response;
    }
}
